.class public Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;
.super Landroid/widget/FrameLayout;
.source "FocusAwareLayout.java"

# interfaces
.implements Landroid/view/View$OnFocusChangeListener;


# static fields
.field private static final BORDER_ALPHA_LEVEL:I = 0xc8

.field private static final LOG:Lcom/burstly/lib/util/LoggerExt; = null

.field private static final STROKE_WIDTH:F = 5.0f

.field private static final TAG:Ljava/lang/String; = "FocusAwareLayout"


# instance fields
.field private mBorder:Landroid/widget/FrameLayout;

.field private mBorderEnabled:Z

.field private mChildView:Landroid/view/View;

.field private mFocusBorder:Landroid/graphics/drawable/ShapeDrawable;

.field private mOriginalListener:Landroid/view/View$OnFocusChangeListener;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 43
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->LOG:Lcom/burstly/lib/util/LoggerExt;

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .locals 1
    .parameter "context"

    .prologue
    .line 91
    const/4 v0, 0x0

    invoke-direct {p0, p1, v0}, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;-><init>(Landroid/content/Context;Landroid/view/View;)V

    .line 92
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/view/View;)V
    .locals 1
    .parameter "context"
    .parameter "childView"

    .prologue
    .line 101
    invoke-direct {p0, p1}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;)V

    .line 78
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mBorderEnabled:Z

    .line 102
    if-eqz p2, :cond_0

    .line 103
    invoke-virtual {p0, p2}, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->addView(Landroid/view/View;)V

    .line 104
    iput-object p2, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mChildView:Landroid/view/View;

    .line 106
    :cond_0
    return-void
.end method

.method private changeBorderState(Z)V
    .locals 5
    .parameter "flag"

    .prologue
    .line 190
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mBorder:Landroid/widget/FrameLayout;

    if-eqz v0, :cond_0

    .line 191
    if-eqz p1, :cond_1

    .line 192
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mBorder:Landroid/widget/FrameLayout;

    new-instance v1, Landroid/widget/FrameLayout$LayoutParams;

    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->getWidth()I

    move-result v2

    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->getHeight()I

    move-result v3

    const/16 v4, 0x11

    invoke-direct {v1, v2, v3, v4}, Landroid/widget/FrameLayout$LayoutParams;-><init>(III)V

    invoke-virtual {p0, v0, v1}, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->addView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V

    .line 197
    :cond_0
    :goto_0
    return-void

    .line 194
    :cond_1
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mBorder:Landroid/widget/FrameLayout;

    invoke-virtual {p0, v0}, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->removeView(Landroid/view/View;)V

    goto :goto_0
.end method


# virtual methods
.method public addView(Landroid/view/View;ILandroid/view/ViewGroup$LayoutParams;)V
    .locals 4
    .parameter "child"
    .parameter "index"
    .parameter "params"

    .prologue
    const/4 v3, 0x3

    .line 124
    invoke-super {p0, p1, p2, p3}, Landroid/widget/FrameLayout;->addView(Landroid/view/View;ILandroid/view/ViewGroup$LayoutParams;)V

    .line 125
    iput-object p1, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mChildView:Landroid/view/View;

    .line 126
    const/4 v1, 0x0

    invoke-virtual {p1, v1}, Landroid/view/View;->setFocusableInTouchMode(Z)V

    .line 127
    invoke-virtual {p1}, Landroid/view/View;->isFocusable()Z

    move-result v1

    if-eqz v1, :cond_0

    .line 128
    new-instance v1, Landroid/widget/FrameLayout;

    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->getContext()Landroid/content/Context;

    move-result-object v2

    invoke-direct {v1, v2}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;)V

    iput-object v1, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mBorder:Landroid/widget/FrameLayout;

    .line 129
    invoke-virtual {p1}, Landroid/view/View;->getOnFocusChangeListener()Landroid/view/View$OnFocusChangeListener;

    move-result-object v1

    iput-object v1, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mOriginalListener:Landroid/view/View$OnFocusChangeListener;

    .line 130
    new-instance v1, Landroid/graphics/drawable/ShapeDrawable;

    invoke-direct {v1}, Landroid/graphics/drawable/ShapeDrawable;-><init>()V

    iput-object v1, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mFocusBorder:Landroid/graphics/drawable/ShapeDrawable;

    .line 131
    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mFocusBorder:Landroid/graphics/drawable/ShapeDrawable;

    const/16 v2, 0xc8

    invoke-virtual {v1, v2}, Landroid/graphics/drawable/ShapeDrawable;->setAlpha(I)V

    .line 132
    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mFocusBorder:Landroid/graphics/drawable/ShapeDrawable;

    invoke-virtual {v1, v3, v3, v3, v3}, Landroid/graphics/drawable/ShapeDrawable;->setPadding(IIII)V

    .line 133
    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mFocusBorder:Landroid/graphics/drawable/ShapeDrawable;

    invoke-virtual {v1}, Landroid/graphics/drawable/ShapeDrawable;->getPaint()Landroid/graphics/Paint;

    move-result-object v0

    .line 134
    .local v0, paint:Landroid/graphics/Paint;
    const v1, -0xff0100

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    .line 135
    sget-object v1, Landroid/graphics/Paint$Style;->STROKE:Landroid/graphics/Paint$Style;

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setStyle(Landroid/graphics/Paint$Style;)V

    .line 136
    const/high16 v1, 0x40a0

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setStrokeWidth(F)V

    .line 137
    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mBorder:Landroid/widget/FrameLayout;

    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mFocusBorder:Landroid/graphics/drawable/ShapeDrawable;

    invoke-static {v1, v2}, Lcom/burstly/lib/util/Utils;->setBackgroundDrawable(Landroid/view/View;Landroid/graphics/drawable/Drawable;)V

    .line 138
    invoke-virtual {p1, p0}, Landroid/view/View;->setOnFocusChangeListener(Landroid/view/View$OnFocusChangeListener;)V

    .line 140
    .end local v0           #paint:Landroid/graphics/Paint;
    :cond_0
    return-void
.end method

.method protected bridge synthetic generateDefaultLayoutParams()Landroid/view/ViewGroup$LayoutParams;
    .locals 1

    .prologue
    .line 38
    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->generateDefaultLayoutParams()Landroid/widget/FrameLayout$LayoutParams;

    move-result-object v0

    return-object v0
.end method

.method protected generateDefaultLayoutParams()Landroid/widget/FrameLayout$LayoutParams;
    .locals 2

    .prologue
    const/4 v1, -0x2

    .line 118
    new-instance v0, Landroid/widget/FrameLayout$LayoutParams;

    invoke-direct {v0, v1, v1}, Landroid/widget/FrameLayout$LayoutParams;-><init>(II)V

    return-object v0
.end method

.method public onFocusChange(Landroid/view/View;Z)V
    .locals 1
    .parameter "view"
    .parameter "flag"

    .prologue
    .line 176
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mOriginalListener:Landroid/view/View$OnFocusChangeListener;

    if-eqz v0, :cond_0

    .line 177
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mOriginalListener:Landroid/view/View$OnFocusChangeListener;

    invoke-interface {v0, p1, p2}, Landroid/view/View$OnFocusChangeListener;->onFocusChange(Landroid/view/View;Z)V

    .line 179
    :cond_0
    iget-boolean v0, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mBorderEnabled:Z

    if-eqz v0, :cond_1

    .line 180
    invoke-direct {p0, p2}, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->changeBorderState(Z)V

    .line 182
    :cond_1
    return-void
.end method

.method public onTouchEvent(Landroid/view/MotionEvent;)Z
    .locals 5
    .parameter "event"

    .prologue
    .line 145
    :try_start_0
    invoke-super {p0, p1}, Landroid/widget/FrameLayout;->onTouchEvent(Landroid/view/MotionEvent;)Z
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result v1

    .line 150
    :goto_0
    return v1

    .line 147
    :catch_0
    move-exception v0

    .line 148
    .local v0, exception:Ljava/lang/Exception;
    sget-object v1, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v2, "FocusAwareLayout"

    invoke-static {v0}, Landroid/util/Log;->getStackTraceString(Ljava/lang/Throwable;)Ljava/lang/String;

    move-result-object v3

    const/4 v4, 0x0

    new-array v4, v4, [Ljava/lang/Object;

    invoke-virtual {v1, v2, v3, v4}, Lcom/burstly/lib/util/LoggerExt;->logWarning(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 150
    const/4 v1, 0x1

    goto :goto_0
.end method

.method public setBorderEnabled(Z)V
    .locals 1
    .parameter "borderEnabled"

    .prologue
    .line 159
    iput-boolean p1, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mBorderEnabled:Z

    .line 160
    if-nez p1, :cond_0

    .line 170
    const/4 v0, 0x0

    invoke-direct {p0, v0}, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->changeBorderState(Z)V

    .line 172
    :cond_0
    return-void
.end method

.method public setTag(Ljava/lang/Object;)V
    .locals 1
    .parameter "tag"

    .prologue
    .line 110
    invoke-super {p0, p1}, Landroid/widget/FrameLayout;->setTag(Ljava/lang/Object;)V

    .line 111
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mChildView:Landroid/view/View;

    if-eqz v0, :cond_0

    .line 112
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/FocusAwareLayout;->mChildView:Landroid/view/View;

    invoke-virtual {v0, p1}, Landroid/view/View;->setTag(Ljava/lang/Object;)V

    .line 114
    :cond_0
    return-void
.end method
